﻿using System.Reflection;

namespace Borg
{
    internal class AddPluginTask : Task<Repository>
    {
        private readonly PluginInfo _pluginInfo;

        public AddPluginTask(Repository obj, PluginInfo pluginInfo,
            uint taskGroupId, Assembly initiator)
            : base(obj, taskGroupId, initiator)
        {
            _pluginInfo = pluginInfo;
        }

        public override void Execute()
        {
            obj.InternalAddPlugin(_pluginInfo, taskGroupId);
        }

        public override string ToString()
        {
            return string.Format("{0}: Repository.InternalAddPlugin({1})", taskGroupId, _pluginInfo);
        }

        public override string Name
        {
            get { return string.Format("AddPlugin({0})", _pluginInfo.Name); }
        }
    }
}

